

export default function MapUILoader () {
    return new Promise((resolve, reject) => {
        if (window.AMapUI) {
            resolve(window.AMapUI)
        } else {
            const script = document.createElement('script')
            script.type = 'text/javascript'
            script.async = true
            script.src = 'http://webapi.amap.com/ui/1.1/main.js?v=1.1.1'
            script.onerror = reject
            document.head.appendChild(script)
        }
        window.initAMap = () => {
            resolve(window.AMapUI)
        }
    })
}
